const { dialog, ipcMain } = require('electron')
let fs = require('fs')
ipcMain.handle('on-getpaper-event',  (e, filename) => {
    // let paper = await fs.readFileSync("./public/"+filename)
    // let jsonPaper = eval("("+paper.toString('utf-8')+")");
    // fs.close(paper)
    // return jsonPaper;


    let paper =null
    let jsonPaper = readFileSync("./public/" + filename);
    jsonPaper = eval("("+jsonPaper.toString('utf-8')+")")
    return jsonPaper
})

function readFileSync(filename) {
    const data = fs.readFileSync(filename, 'utf8');
    console.log("getpaper finish read file")
    return data
}
